﻿<navigation:Page xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"  xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"  x:Class="MusicStore.Silverlight.Views.Search" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           xmlns:layoutToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Layout.Toolkit"
           d:DesignWidth="640" d:DesignHeight="480"
           Title="Search Page">
    <navigation:Page.Resources>
        <Style x:Key="TextBlockTitle" TargetType="TextBlock">
            <Setter Property="FontWeight" Value="Bold" />
            <Setter Property="FontSize" Value="16" />
        </Style>
        <Style x:Key="TextBlockData" TargetType="TextBlock">
            <Setter Property="FontWeight" Value="Bold" />
            <Setter Property="FontSize" Value="12" />
        </Style>
    </navigation:Page.Resources>
    <controlsToolkit:BusyIndicator IsBusy="{Binding IsBusy}">
        <Grid x:Name="LayoutRoot">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" MinHeight="48"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <StackPanel Orientation="Horizontal" >
                <TextBox x:Name="TxtSearch" HorizontalAlignment="Left" Margin="0,8" Width="256" />
                <Button x:Name="BtnSearch" Margin="10,8" Width="100" Content="Search" Command="{Binding SearchCommand}" CommandParameter="{Binding ElementName=TxtSearch, Path=Text}" />
                <Button x:Name="BtnAddNewAlbum" Margin="10,8" Width="100" Content="Add New Album" Command="{Binding OpenAlbumCommand}"/>
                <!--<Button Content="Search" Name="button1" Width="100" Click="BtnSearch_Click" />-->
            </StackPanel>

            <data:DataPager Grid.Row="1" Source="{Binding SearchResults}" PageSize="10" ></data:DataPager>
            <ScrollViewer Grid.Row="2">
                <ItemsControl x:Name="SearchResult" ItemsSource="{Binding SearchResults}">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <!--<layoutToolkit:Accordion HorizontalAlignment="Stretch" SelectionMode="ZeroOrMore">
                        <layoutToolkit:AccordionItem Style="{StaticResource AccItemExplicit}">
                           <layoutToolkit:AccordionItem.Header>
                              <Grid Height="50" Margin="0" VerticalAlignment="Center">
                                 <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="50" />
                                    <ColumnDefinition Width="*" />
                                 </Grid.ColumnDefinitions>
                                 <Border Grid.Column="0" VerticalAlignment="Center" Tag="{Binding Id}" MouseLeftButtonDown="ItemClick">
                                    <Border.Effect>
                                       <DropShadowEffect BlurRadius="16" ShadowDepth="0" Opacity="1" Color="#C0DEED" />
                                    </Border.Effect>
                                    <Image Source="{Binding Image}" Width="30" Height="30" Cursor="Hand" />
                                 </Border>
                                 <TextBlock Grid.Column="1" Margin="20,0,0,0" Text="{Binding Title}" FontSize="30" VerticalAlignment="Center" />
                              </Grid>
                           </layoutToolkit:AccordionItem.Header>
                           <StackPanel Orientation="Horizontal">
                              <Border Margin="6"  Grid.Column="0" VerticalAlignment="Center" Tag="{Binding Id}" MouseLeftButtonDown="ItemClick">
                                 <Border.Effect>
                                    <DropShadowEffect BlurRadius="16" ShadowDepth="0" Opacity="1" Color="#C0DEED" />
                                 </Border.Effect>
                                 <Image Source="{Binding Image}" Width="80" Height="80" Cursor="Hand" />
                              </Border>
                              <Grid>
                                 <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="60" />
                                    <ColumnDefinition />
                                 </Grid.ColumnDefinitions>
                                 <Grid.RowDefinitions>
                                    <RowDefinition />
                                    <RowDefinition />
                                    <RowDefinition />
                                    <RowDefinition />
                                 </Grid.RowDefinitions>
                                 <TextBlock Grid.Column="0" Grid.Row="0" Text="Author" />
                                 <TextBlock Grid.Column="0" Grid.Row="1" Text="Genre" />
                                 <TextBlock Grid.Column="0" Grid.Row="2" Text="Label" />
                                 <TextBlock Grid.Column="0" Grid.Row="3" Text="Date" />
                                 <TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding Author}" Style="{StaticResource TextBlockData}" />
                                 <TextBlock Grid.Column="1" Grid.Row="1" Text="{Binding Genre}" Style="{StaticResource TextBlockData}" />
                                 <TextBlock Grid.Column="1" Grid.Row="2" Text="{Binding Label}" Style="{StaticResource TextBlockData}" />
                                 <TextBlock Grid.Column="1" Grid.Row="3" Text="{Binding Path=PublicationDate, Converter={StaticResource DateTimeFormatter}, ConverterParameter=yyyy}" Style="{StaticResource TextBlockData}" />
                              </Grid>
                           </StackPanel>
                        </layoutToolkit:AccordionItem>
                     </layoutToolkit:Accordion>-->
                            <Border Margin="5" BorderThickness="1" BorderBrush="Black">
                                <Grid Margin="0,5,0,5">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="80" />
                                        <ColumnDefinition Width="*" />
                                    </Grid.ColumnDefinitions>
                                    <Button Command="{Binding ElementName=LayoutRoot, Path=DataContext.OpenAlbumCommand}" CommandParameter="{Binding Id}">
                                        <Button.Template>
                                            <ControlTemplate>
                                                <!--Tag="{Binding Id}" MouseLeftButtonDown="ItemClick"-->
                                                <Border HorizontalAlignment="Center" VerticalAlignment="Center">
                                                    <Border.Effect>
                                                        <DropShadowEffect BlurRadius="100" ShadowDepth="0" Opacity="1" Color="#FFFFFF" />
                                                    </Border.Effect>
                                                    <Image Source="{Binding Image}" Width="60" Height="60" Cursor="Hand"/>
                                                </Border>
                                            </ControlTemplate>
                                        </Button.Template>
                                    </Button>
                                    <StackPanel Grid.Column="1">
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="{Binding Title}" Style="{StaticResource TextBlockTitle}"/>
                                            <TextBlock Text=" - (" Style="{StaticResource TextBlockTitle}"/>
                                            <TextBlock Text="{Binding Path=PublicationDate, Converter={StaticResource DateTimeFormatter}, ConverterParameter=yyyy}" Style="{StaticResource TextBlockTitle}"/>
                                            <TextBlock Text=")" Style="{StaticResource TextBlockTitle}"/>
                                        </StackPanel>
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="60" />
                                                <ColumnDefinition />
                                            </Grid.ColumnDefinitions>
                                            <Grid.RowDefinitions>
                                                <RowDefinition />
                                                <RowDefinition />
                                                <RowDefinition />
                                            </Grid.RowDefinitions>
                                            <TextBlock Grid.Column="0" Grid.Row="0" Text="Author" />
                                            <TextBlock Grid.Column="0" Grid.Row="1" Text="Genre" />
                                            <TextBlock Grid.Column="0" Grid.Row="2" Text="Label" />
                                            <TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding Author}" Style="{StaticResource TextBlockData}" />
                                            <TextBlock Grid.Column="1" Grid.Row="1" Text="{Binding Genre}" Style="{StaticResource TextBlockData}" />
                                            <TextBlock Grid.Column="1" Grid.Row="2" Text="{Binding Label}" Style="{StaticResource TextBlockData}" />
                                        </Grid>
                                    </StackPanel>
                                </Grid>
                            </Border>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </ScrollViewer>

        </Grid>
    </controlsToolkit:BusyIndicator>
</navigation:Page>
